package com.ace.scenep.day0116;



import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Example {
    public static void main(String[] args) {
        // 配置热加载示例
        ConfigHotLoader config = new ConfigHotLoader("config.properties");
        
        // 添加配置变更监听器
        config.addListener((key, oldValue, newValue) -> {
            System.out.println("Config changed: " + key + " from " + oldValue + " to " + newValue);
        });
        
        // 获取配置
        String value = config.getConfig("someKey");
        
        // HTTP客户端示例
        HttpClient client = new HttpClient();
        
        try {
            // GET请求
            String response = client.get(
                "https://api.example.com/data",
                Collections.singletonMap("Authorization", "Bearer token"),
                String.class
            );
            
            // POST JSON请求
            Map<String, String> data = new HashMap<>();
            data.put("name", "test");
            
            MyResponse result = client.postJson(
                "https://api.example.com/create",
                data,
                null,
                MyResponse.class
            );
            
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    static class MyResponse {
        private String id;
        private String message;
        // getters and setters
    }
} 